package biz.obake.team.touchprotector.lfd;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import androidx.appcompat.app.c;
import biz.obake.team.touchprotector.R;
import biz.obake.team.touchprotector.g.c;
import biz.obake.team.touchprotector.tpservice.TPService;

public class LfdPresetActivity extends c implements c.b {
    private GridView t;
    private g u;

    class a implements AdapterView.OnItemClickListener {
        a() {
        }

        public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
            LfdPresetActivity.this.H(i);
        }
    }

    /* access modifiers changed from: private */
    public void H(int i) {
        f.d().i(e.d().a(i));
        this.u.notifyDataSetChanged();
        TPService.k("Design", "LfdPreset");
    }

    private void I() {
        int i;
        GridView gridView;
        if ("Locked".equals(biz.obake.team.touchprotector.g.c.c("TPService.State"))) {
            gridView = this.t;
            i = 4;
        } else {
            gridView = this.t;
            i = 0;
        }
        gridView.setVisibility(i);
    }

    /* access modifiers changed from: protected */
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView((int) R.layout.lfd_preset_activity);
        this.t = (GridView) findViewById(R.id.gridView);
        g gVar = new g(e.d());
        this.u = gVar;
        this.t.setAdapter(gVar);
        this.t.setOnItemClickListener(new a());
    }

    /* access modifiers changed from: protected */
    public void onPause() {
        super.onPause();
        biz.obake.team.touchprotector.g.c.h(this);
    }

    public void onRamPrefsChanged(String str) {
        if (((str.hashCode() == -2066548004 && str.equals("TPService.State")) ? (char) 0 : 65535) == 0) {
            I();
        }
    }

    /* access modifiers changed from: protected */
    public void onResume() {
        super.onResume();
        I();
        biz.obake.team.touchprotector.g.c.e(this);
    }
}
